package com.wc.alorithm_blue_bridge._动态规划.蓝桥字符;

import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.io.PrintWriter;
import java.util.StringTokenizer;

/**
 * @Author congge
 * @Date 2025/3/29 12:06
 * @description
 * https://www.lanqiao.cn/problems/20270/learning/?contest_id=250
 */
public class Main {
    /**
     * 思路：
     * num['l'] 代表有几个 l   num['l'] += s[i] == 'l' ? 1 : 0;
     * num['a'] 代表有几个 la  num['a'] += num['l']
     * num['n'] 代表有几个 lan num['n'] += num['a']
     */
    static FastReader sc = new FastReader();
    static PrintWriter out = new PrintWriter(System.out);
    static int N = 100010;
    static int[] num = new int[128];
    static char[] s = new char[N];

    public static void main(String[] args) {
        s = (" " + sc.next()).toCharArray();
        int n = s.length - 1;
        for (int i = 1; i <= n; i++) {
            if (s[i] == 'l') num['l']++;
            if (s[i] == 'a') num['a'] += num['l'];
            if (s[i] == 'n') num['n'] += num['a'];
        }
        out.println(num['n']);
        out.flush();
    }
}

class FastReader {
    StringTokenizer st;
    BufferedReader br;

    FastReader() {
        br = new BufferedReader(new InputStreamReader(System.in));
    }

    String next() {
        while (st == null || !st.hasMoreElements()) {
            try {
                st = new StringTokenizer(br.readLine());
            } catch (IOException e) {
                e.printStackTrace();
            }
        }
        return st.nextToken();
    }

    int nextInt() {
        return Integer.parseInt(next());
    }

    String nextLine() {
        String s = "";
        try {
            s = br.readLine();
        } catch (IOException e) {
            e.printStackTrace();
        }
        return s;
    }

    long nextLong() {
        return Long.parseLong(next());
    }

    double nextDouble() {
        return Double.parseDouble(next());
    }

    // 是否由下一个
    boolean hasNext() {
        while (st == null || !st.hasMoreTokens()) {
            try {
                String line = br.readLine();
                if (line == null)
                    return false;
                st = new StringTokenizer(line);
            } catch (IOException e) {
                throw new RuntimeException(e);
            }
        }
        return true;
    }
}

